package com.jn.exam.easypoi.service.impl;

import com.jn.exam.easypoi.entity.PersonalQuestion;
import com.jn.exam.easypoi.mapper.PersonalQuestionMapper;
import com.jn.exam.easypoi.service.OssFeignService;
import com.jn.exam.easypoi.service.PersonalQuestionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.io.File;
import java.util.concurrent.Future;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 江南大学1033190417
 * @since 2022-01-23
 */
@Service
public class PersonalQuestionServiceImpl extends ServiceImpl<PersonalQuestionMapper, PersonalQuestion> implements PersonalQuestionService {

    @Autowired
    private OssFeignService ossFeignService;

    @Override
    @Async
    public  Future<Boolean> savePersonalQuestionFromExcel(PersonalQuestion personalQuestion,String personalQuestionStoreId) throws Exception{
        personalQuestion.setStoreId(personalQuestionStoreId);
        int insert = baseMapper.insert(personalQuestion);
        if (insert==1){
            return new AsyncResult<>(true);
        }
        return new AsyncResult<>(false);
    }
}
